package dk.mirasola.systemtraining.bridgewidgets.client.ui.editor;

import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;

public class PopupFactory {
    private PopupFactory() {
    }

    public static PopupPanel createEditorInfoPopup(boolean autoHide, int left, int top) {
        return createPopupPanel(null, autoHide, "editor-info", left, top);
    }

    private static PopupPanel createPopupPanel(String message, boolean autoHide, String stylePrimaryName, int left, int top) {
        PopupPanel popupPanel = new PopupPanel(autoHide);
        popupPanel.setStylePrimaryName(stylePrimaryName);
        popupPanel.setPopupPosition(left, top);
        if (message != null) {
            popupPanel.setWidget(new Label(message));
        }
        return popupPanel;
    }
}
